﻿<%@ Page 
    Language="C#" 
    AutoEventWireup="true" 
    CodeBehind="AlunoListar.aspx.cs" 
    Inherits="Arquitetura.UI.WebApp.AlunoListar" 
    MasterPageFile="~/Master/Default.Master"
    Theme="Default"
%>
<asp:Content ContentPlaceHolderID="cphHead" runat="server">
</asp:Content>
<asp:Content ContentPlaceHolderID="cphContent" runat="server">
    <h1>
        Alunos
    </h1>
    <asp:UpdatePanel ID="upAlunoListar"
        runat="server"
        ChildrenAsTriggers="true"
        RenderMode="Inline"
        UpdateMode="Conditional">
        <ContentTemplate>
            <div class="Cadastro">
                <table>
                    <tr>
                        <td>
                            <label for="<%= txtNome.ClientID %>">
                                <asp:Label ID="lblNome" 
                                    runat="server"
                                    SkinID="TituloCampo" 
                                    Text="Nome:"/>
                            </label>
                        </td>
                        <td>
                            <asp:TextBox ID="txtNome"
                                runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="<%= txtSobrenome.ClientID %>">
                                <asp:Label ID="lblSobrenome" 
                                    runat="server"
                                    SkinID="TituloCampo" 
                                    Text="Sobrenome:"/>
                            </label>
                        </td>
                        <td>
                            <asp:TextBox ID="txtSobrenome"
                                runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td />
                        <td>
                            <asp:Button ID="btnFiltrar"
                                runat="server"
                                OnClick="btnPesquisar_Click"
                                Text="Pesquisar" />
                            <asp:Button ID="btnLimpar"
                                runat="server"
                                OnClick="btnLimpar_Click"
                                Text="Limpar" />              
                        </td>
                    </tr>
                </table>
            </div>
            <asp:GridView ID="grvAlunos"
                runat="server"
                AllowPaging="true"
                AutoGenerateColumns="false"
                EmptyDataText="Não foi encontrado nenhum aluno."
                OnPageIndexChanging="grvAlunos_PageIndexChanging"
                SkinID="Grid">
                <Columns>
                    <asp:TemplateField HeaderText="Prontuário">
                        <ItemTemplate>
                            <%# Eval("Prontuario") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Nome">
                        <ItemTemplate>
                            <%# Eval("Nome") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Sobrenome">
                        <ItemTemplate>
                            <%# Eval("Sobrenome") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="CPF">
                        <ItemTemplate>
                            <%# Eval("CPF") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="RG">
                        <ItemTemplate>
                            <%# Eval("RG") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Nome da Mãe">
                        <ItemTemplate>
                            <%# Eval("Mae.Nome") + " " + Eval("Mae.Sobrenome") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <div>
                <asp:Button ID="btnIncluir"
                    runat="server"
                    OnClick="btnIncluir_Click"
                    Text="Incluir" />
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="btnFiltrar" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>